<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>影像系统测试页面</title>
    <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/vendor/jquery.ui.widget.js"></script>
    <script type="text/javascript" src="js/jquery.iframe-transport.js"></script>
    <script type="text/javascript" src="js/jquery.fileupload.js"></script>
    <script type="text/javascript">
        (function ($) {
            $(function () {
                $('#cem_storage_file').fileupload({
                    url: 'upload.api?appKey=enfrytest&token=2D5D343494C064E05A84B89AB94706CE&ts=1441870453256',
                    dataType: 'json',
                    done: function (e, data) {
                        console.info(data.result);
                    },
                    fail: function (e, data) {
                        console.info(data.errorThrown);
                    },
                    progressall: function (e, data) {
                        console.info("start upload");
                    }
                });

                $("#delBtn").click(function () {
                    $.ajax({
                        url: "delete.api",
                        data: {
                            fileCode: $("#fileCode").val(),
                            token: 'D5ADFDCEC78FFD2C4DA55F33DC3D7D50&ts=1442229105290&appKey=enfrytest'
                        },
                        dataType: "json",
                        type: "POST",
                        success: function (data) {
                            console.info(data);
                            alert(data.fileUrl);
                        }
                    });
                });

                $(".testGet").attr("src", window.location.href + "img.api?token=0943485D2C8740E62E57BB377F6E668A&ts=3284071923874102938&fileCode=group1/M00/00/10/wKgAUFZQDS2ATxknAAvecMZN2ZY6.1.jpg&appKey=enfrytest");
            });
        })(jQuery);
    </script>
</head>
<body>
<h2>同步上传</h2>

<form enctype="multipart/form-data" method="post"
      action="upload.api?appKey=enfrytest&token=2D5D343494C064E05A84B89AB94706CE&ts=1441870453256">
    <input type="file" name="storage_file"/>
    <input type="submit"/>
</form>

<h2>异步上传</h2>
<input type="file" id="storage_file" name="storage_file" multiple/>

<h2>删除图片</h2>
<input type="text" id="fileCode" name="fileCode"/>
<button id="delBtn">删除</button>

<h2>浏览图片</h2>
<img width="300" class="testGet">
<br>
<img width="50" src="img.api?token=0943485D2C8740E62E57BB377F6E668A&ts=3284071923874102938&fileCode=group1/M00/00/00/wKgBHleNhQiAK2rdAAD_oIcNNRw0.1.jpg&appKey=enfrytest" alt="">
</body>
</html>